# Kernel config based on: arch/arm/configs/cyanogenmod_tuna_defconfig

pkgname=linux-samsung-maguro
pkgver=3.0.31
pkgrel=14
pkgdesc="Samsung Galaxy Nexus kernel from LineageOS"
arch="armv7"
_carch="arm"
_flavor="samsung-maguro"
url="https://github.com/LineageOS/android_kernel_samsung_tuna"
license="GPL2"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev gcc6"

# Compiler: this kernel was only tested with GCC6. Feel free to make a merge
# request if you find out that it is booting working with newer GCCs as
# well. See <https://postmarketos.org/vendorkernel> for instructions.
if [ "${CC:0:5}" != "gcc6-" ]; then
	CC="gcc6-$CC"
	HOSTCC="gcc6-gcc"
	CROSS_COMPILE="gcc6-$CROSS_COMPILE"
fi

# Source
_repository="android_kernel_samsung_tuna"
_commit="e14e5fe679a63eef92346cde874175d8b62b6a4a"
_config="config-$_flavor.armv7"
source="
	$pkgname-$_commit.tar.gz::https://github.com/LineageOS/$_repository/archive/$_commit.tar.gz
	$_config
	timeconst.pl-Eliminate-Perl-warning.patch
	android_paranoid_network.patch
"
builddir="$srcdir/$_repository-$_commit"

prepare() {
	default_prepare
	. downstreamkernel_prepare
}

build() {
	unset LDFLAGS
	make ARCH="$_carch" CC="${CC:-gcc}" \
		KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine"
}

package() {
	install -Dm644 "$builddir/arch/arm/boot/zImage" \
		"$pkgdir/boot/vmlinuz-$_flavor"

	install -D "$builddir/include/config/kernel.release" \
		"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
}

sha512sums="f117b3202c3db1a575598fd87ee27080db5c447c986ced677b63e6b00613ebfab58d634bf63b8bcf0c229eb0bec4dc81b13d7cfda3c2aee62e9ed8e26eeb860c  linux-samsung-maguro-e14e5fe679a63eef92346cde874175d8b62b6a4a.tar.gz
ecf76836c315aeff003dff031b688b6cae69623510ac1c0bed8bbd986dfc3268fad38a5b14f0fac4b530f785a570afd018094e9d6b57c65f56f1f906051e3b66  config-samsung-maguro.armv7
1fcfb5f06a2bfdcc55d53054ca80d1b989599a39a5379d057a0724fc405187d74da4309a650e70b9c79d39444e81923cfc5c9199ed8c0a77c83dcd7998446bb7  timeconst.pl-Eliminate-Perl-warning.patch
d8cdc1137e6a4ad78a3a31acc40f0c98f4db272eaf5b90ee850abb83b80916c4ff3c18a0a181e94eebead44213f6314e3363d0c4b91d95ee1adafbcad6dc57ab  android_paranoid_network.patch"
